﻿

using System;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace Demo.ServiceContracts
{
    [DataContract]
    public  class FaultData
    {
        #region Public Properties

        [DataMember(Order=0)]
        public string Message { get; set; }

        [DataMember(Order = 1)]
        public string FullMessage { get; set; }

        [DataMember(Order = 2)]
        public string StackTrace { get; set; }

        #endregion

        #region  Public Static Method

        public static FaultData CreateFromException(Exception ex)
        {
            return new FaultData { Message = ex.Message, FullMessage = ex.ToString(), StackTrace = ex.StackTrace };
        }

        public static FaultReason CreateFaultReason(Exception ex)
        {
            return new FaultReason(ex.Message);
        }

        #endregion




    }
}
